.class public Lcom/opongo/blogapp/activities/CommentAddActivity;
.super Landroid/app/Activity;
.source "CommentAddActivity.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/opongo/blogapp/activities/CommentAddActivity$downloadSendCommentAsyncTask;
    }
.end annotation


# static fields
#the value of this static final field might be set in the static constructor
.field public static final DEBUG:Z = false

.field public static final PREFS_NAME:Ljava/lang/String; = "BlogApp"

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private apiManager:Lcom/opongo/blogapp/manager/APIManager;

.field private comment_parent:I

.field private edit_comment:Landroid/widget/EditText;

.field private edit_email:Landroid/widget/EditText;

.field private edit_name:Landroid/widget/EditText;

.field private edit_password:Landroid/widget/EditText;

.field private editor:Landroid/content/SharedPreferences$Editor;

.field private email:Ljava/lang/String;

.field private password:Ljava/lang/String;

.field private postid:I

.field private progressDialog:Landroid/app/ProgressDialog;

.field private settings:Landroid/content/SharedPreferences;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 32
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/activities/CommentAddActivity;->DEBUG:Z

    .line 33
    const-class v0, Lcom/opongo/blogapp/activities/CommentsListActivity;

    .line 34
    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    .line 33
    sput-object v0, Lcom/opongo/blogapp/activities/CommentAddActivity;->TAG:Ljava/lang/String;

    .line 30
    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 30
    invoke-direct {p0}, Landroid/app/Activity;-><init>()V

    .line 35
    const/4 v0, -0x1

    iput v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->postid:I

    .line 36
    const/4 v0, 0x0

    iput v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->comment_parent:I

    .line 30
    return-void
.end method

.method static synthetic access$0()Ljava/lang/String;
    .locals 1

    .prologue
    .line 33
    sget-object v0, Lcom/opongo/blogapp/activities/CommentAddActivity;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$1(Lcom/opongo/blogapp/activities/CommentAddActivity;)Lcom/opongo/blogapp/manager/APIManager;
    .locals 1
    .parameter

    .prologue
    .line 31
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->apiManager:Lcom/opongo/blogapp/manager/APIManager;

    return-object v0
.end method

.method static synthetic access$10(Lcom/opongo/blogapp/activities/CommentAddActivity;Ljava/lang/String;Ljava/lang/String;Z)V
    .locals 0
    .parameter
    .parameter
    .parameter
    .parameter

    .prologue
    .line 210
    invoke-direct {p0, p1, p2, p3}, Lcom/opongo/blogapp/activities/CommentAddActivity;->showAlert(Ljava/lang/String;Ljava/lang/String;Z)V

    return-void
.end method

.method static synthetic access$2(Lcom/opongo/blogapp/activities/CommentAddActivity;)I
    .locals 1
    .parameter

    .prologue
    .line 35
    iget v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->postid:I

    return v0
.end method

.method static synthetic access$3(Lcom/opongo/blogapp/activities/CommentAddActivity;)Landroid/widget/EditText;
    .locals 1
    .parameter

    .prologue
    .line 45
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_comment:Landroid/widget/EditText;

    return-object v0
.end method

.method static synthetic access$4(Lcom/opongo/blogapp/activities/CommentAddActivity;)Landroid/widget/EditText;
    .locals 1
    .parameter

    .prologue
    .line 42
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_name:Landroid/widget/EditText;

    return-object v0
.end method

.method static synthetic access$5(Lcom/opongo/blogapp/activities/CommentAddActivity;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 46
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->email:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$6(Lcom/opongo/blogapp/activities/CommentAddActivity;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 47
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->password:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$7(Lcom/opongo/blogapp/activities/CommentAddActivity;)I
    .locals 1
    .parameter

    .prologue
    .line 36
    iget v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->comment_parent:I

    return v0
.end method

.method static synthetic access$8(Lcom/opongo/blogapp/activities/CommentAddActivity;)Landroid/app/ProgressDialog;
    .locals 1
    .parameter

    .prologue
    .line 48
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->progressDialog:Landroid/app/ProgressDialog;

    return-object v0
.end method

.method static synthetic access$9(Lcom/opongo/blogapp/activities/CommentAddActivity;)Landroid/content/SharedPreferences$Editor;
    .locals 1
    .parameter

    .prologue
    .line 40
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->editor:Landroid/content/SharedPreferences$Editor;

    return-object v0
.end method

.method private showAlert(Ljava/lang/String;Ljava/lang/String;Z)V
    .locals 3
    .parameter "title"
    .parameter "text"
    .parameter "onBackPressed"

    .prologue
    .line 211
    new-instance v1, Landroid/app/AlertDialog$Builder;

    invoke-direct {v1, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    invoke-virtual {v1}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v0

    .line 212
    .local v0, alertDialog:Landroid/app/AlertDialog;
    invoke-virtual {v0, p1}, Landroid/app/AlertDialog;->setTitle(Ljava/lang/CharSequence;)V

    .line 213
    invoke-virtual {v0, p2}, Landroid/app/AlertDialog;->setMessage(Ljava/lang/CharSequence;)V

    .line 214
    const v1, 0x7f020009

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setIcon(I)V

    .line 216
    if-eqz p3, :cond_0

    .line 217
    const-string v1, "OK"

    new-instance v2, Lcom/opongo/blogapp/activities/CommentAddActivity$1;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/CommentAddActivity$1;-><init>(Lcom/opongo/blogapp/activities/CommentAddActivity;)V

    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog;->setButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    .line 231
    :goto_0
    invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V

    .line 232
    return-void

    .line 224
    :cond_0
    const-string v1, "OK"

    new-instance v2, Lcom/opongo/blogapp/activities/CommentAddActivity$2;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/CommentAddActivity$2;-><init>(Lcom/opongo/blogapp/activities/CommentAddActivity;)V

    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog;->setButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    goto :goto_0
.end method


# virtual methods
.method public onClickSendComment(Landroid/view/View;)V
    .locals 8
    .parameter "commentView"

    .prologue
    const v7, 0x7f070034

    const v6, 0x7f070024

    const/4 v5, 0x1

    const/4 v4, 0x0

    .line 90
    sget-object v1, Lcom/opongo/blogapp/activities/CommentAddActivity;->TAG:Ljava/lang/String;

    const-string v2, "AddCommentClicked"

    invoke-static {v1, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 92
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->editor:Landroid/content/SharedPreferences$Editor;

    const-string v2, "edit_name"

    iget-object v3, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_name:Landroid/widget/EditText;

    invoke-virtual {v3}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v3

    invoke-interface {v3}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 93
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->editor:Landroid/content/SharedPreferences$Editor;

    const-string v2, "edit_email"

    iget-object v3, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_email:Landroid/widget/EditText;

    invoke-virtual {v3}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v3

    invoke-interface {v3}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 95
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_comment:Landroid/widget/EditText;

    invoke-virtual {v1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v0

    .line 96
    .local v0, edit_text:Ljava/lang/String;
    const-string v1, "\n"

    const-string v2, ""

    invoke-virtual {v0, v1, v2}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v2, "\r"

    const-string v3, ""

    invoke-virtual {v1, v2, v3}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v2, "\t"

    const-string v3, ""

    invoke-virtual {v1, v2, v3}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v2, " "

    const-string v3, ""

    invoke-virtual {v1, v2, v3}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 97
    const-string v1, ""

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 98
    invoke-virtual {p0, v6}, Lcom/opongo/blogapp/activities/CommentAddActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v7}, Lcom/opongo/blogapp/activities/CommentAddActivity;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-direct {p0, v1, v2, v4}, Lcom/opongo/blogapp/activities/CommentAddActivity;->showAlert(Ljava/lang/String;Ljava/lang/String;Z)V

    .line 135
    :goto_0
    return-void

    .line 102
    :cond_0
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_name:Landroid/widget/EditText;

    invoke-virtual {v1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v0

    .line 103
    const-string v1, "\n"

    const-string v2, ""

    invoke-virtual {v0, v1, v2}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v2, "\r"

    const-string v3, ""

    invoke-virtual {v1, v2, v3}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v2, "\t"

    const-string v3, ""

    invoke-virtual {v1, v2, v3}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v2, " "

    const-string v3, ""

    invoke-virtual {v1, v2, v3}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 104
    const-string v1, ""

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 105
    invoke-virtual {p0, v6}, Lcom/opongo/blogapp/activities/CommentAddActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v7}, Lcom/opongo/blogapp/activities/CommentAddActivity;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-direct {p0, v1, v2, v4}, Lcom/opongo/blogapp/activities/CommentAddActivity;->showAlert(Ljava/lang/String;Ljava/lang/String;Z)V

    goto :goto_0

    .line 125
    :cond_1
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_email:Landroid/widget/EditText;

    if-eqz v1, :cond_2

    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_email:Landroid/widget/EditText;

    invoke-virtual {v1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v1

    :goto_1
    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->email:Ljava/lang/String;

    .line 126
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_password:Landroid/widget/EditText;

    if-eqz v1, :cond_3

    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_password:Landroid/widget/EditText;

    invoke-virtual {v1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v1

    :goto_2
    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->password:Ljava/lang/String;

    .line 128
    new-instance v1, Landroid/app/ProgressDialog;

    invoke-direct {v1, p0}, Landroid/app/ProgressDialog;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->progressDialog:Landroid/app/ProgressDialog;

    .line 129
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->progressDialog:Landroid/app/ProgressDialog;

    const v2, 0x7f070036

    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/activities/CommentAddActivity;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/app/ProgressDialog;->setMessage(Ljava/lang/CharSequence;)V

    .line 130
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->progressDialog:Landroid/app/ProgressDialog;

    invoke-virtual {v1, v4}, Landroid/app/ProgressDialog;->setIndeterminate(Z)V

    .line 131
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->progressDialog:Landroid/app/ProgressDialog;

    invoke-virtual {v1, v5}, Landroid/app/ProgressDialog;->setCancelable(Z)V

    .line 132
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->progressDialog:Landroid/app/ProgressDialog;

    invoke-virtual {v1}, Landroid/app/ProgressDialog;->show()V

    .line 134
    new-instance v1, Lcom/opongo/blogapp/activities/CommentAddActivity$downloadSendCommentAsyncTask;

    const/4 v2, 0x0

    invoke-direct {v1, p0, v2}, Lcom/opongo/blogapp/activities/CommentAddActivity$downloadSendCommentAsyncTask;-><init>(Lcom/opongo/blogapp/activities/CommentAddActivity;Lcom/opongo/blogapp/activities/CommentAddActivity$downloadSendCommentAsyncTask;)V

    new-array v2, v5, [Ljava/lang/String;

    const-string v3, ""

    aput-object v3, v2, v4

    invoke-virtual {v1, v2}, Lcom/opongo/blogapp/activities/CommentAddActivity$downloadSendCommentAsyncTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    goto/16 :goto_0

    .line 125
    :cond_2
    const-string v1, ""

    goto :goto_1

    .line 126
    :cond_3
    const-string v1, ""

    goto :goto_2
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 5
    .parameter "savedInstanceState"

    .prologue
    .line 53
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 56
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/CommentAddActivity;->getIntent()Landroid/content/Intent;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 59
    .local v0, extras:Landroid/os/Bundle;
    if-nez v0, :cond_0

    .line 87
    :goto_0
    return-void

    .line 62
    :cond_0
    const-string v1, "POSTID"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->postid:I

    .line 64
    const-string v1, "PARENTID"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->containsKey(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 65
    const-string v1, "PARENTID"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->comment_parent:I

    .line 67
    :cond_1
    new-instance v1, Lcom/opongo/blogapp/manager/APIManager;

    invoke-direct {v1, p0}, Lcom/opongo/blogapp/manager/APIManager;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->apiManager:Lcom/opongo/blogapp/manager/APIManager;

    .line 69
    const-string v1, "BlogApp"

    const/4 v2, 0x0

    invoke-virtual {p0, v1, v2}, Lcom/opongo/blogapp/activities/CommentAddActivity;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v1

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->settings:Landroid/content/SharedPreferences;

    .line 70
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->settings:Landroid/content/SharedPreferences;

    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v1

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->editor:Landroid/content/SharedPreferences$Editor;

    .line 77
    const v1, 0x7f030001

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentAddActivity;->setContentView(I)V

    .line 80
    const v1, 0x7f080009

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentAddActivity;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/EditText;

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_name:Landroid/widget/EditText;

    .line 81
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_name:Landroid/widget/EditText;

    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->settings:Landroid/content/SharedPreferences;

    const-string v3, "edit_name"

    const-string v4, ""

    invoke-interface {v2, v3, v4}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V

    .line 83
    const v1, 0x7f08000b

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentAddActivity;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/EditText;

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_email:Landroid/widget/EditText;

    .line 84
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_email:Landroid/widget/EditText;

    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->settings:Landroid/content/SharedPreferences;

    const-string v3, "edit_email"

    const-string v4, ""

    invoke-interface {v2, v3, v4}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V

    .line 86
    const v1, 0x7f08000f

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentAddActivity;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/EditText;

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentAddActivity;->edit_comment:Landroid/widget/EditText;

    goto :goto_0
.end method
